<?php
/**
 * tpshop
 * ============================================================================
 * 版权所有 2015-2027 深圳搜豹网络科技有限公司，并保留所有权利。
 * 网站地址: http://www.tp-shop.cn
 * ----------------------------------------------------------------------------
 * Licensed ( http://www.apache.org/licenses/LICENSE-2.0 )
 * ============================================================================
 * Author: 当燃      
 * Date: 2015-09-21
 */

namespace Admin\Controller;

class JoinController extends BaseController{

    public function join_list(){


        $model=M('join');
        $count = $model->where($where)->count();// 查询满足要求的总记录数
        $Page = new \Think\Page($count,10);// 实例化分页类 传入总记录数和每页显示的记录数
        $lists = $model->where($where)->order('id desc')->limit($Page->firstRow.','.$Page->listRows)->select();
        $show = $Page->show();// 分页显示输出
        $this->assign('page',$show);// 赋值分页输出
        $this->assign('lists',$lists);
        $this->display();
    }


    public function delete_join(){
        $where['id']=I('id');
        $res=M('join')->where($where)->delete();//删除提问
        if(!$res)
            $this->error('删除失败，请重试！');
        else
            $this->success('删除成功。');
    }


    public function detail(){
        $id=I('id');
        $where['id']=$id;
        $model=M('join');
        $data = $model->where($where)->find();
        $up_data['id']=$id;
        $up_data['status']=1;
        $model->save($up_data);//更新为已查看
        $this->assign('data',$data);
        $this->display();

    }
}